

class MyThread extends Thread{
    @Override
    public void run() {
      while (true){
          System.out.println("my thread");
          try {
              Thread.sleep(1000);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
      }
    }
}



public class Test1 {
    public static void main(String[] args) throws InterruptedException {
     MyThread myThread1 = new MyThread();
     myThread1.start();
     while(true){
         System.out.println("main");
         Thread.sleep(1000);
     }

    }
}
